//
//  MainViewController.m
//  sinaWeiBo
//
//  Created by feng on 16/9/3.
//  Copyright © 2016年 feng. All rights reserved.
//

#import "MainViewController.h"
#import "HomeTableViewController.h"
#import "MessageTableViewController.h"
#import "DiscoverTableViewController.h"
#import "ProfileTableViewController.h"
#import "MainTabbar.h"

@interface MainViewController ()

@end

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addChildViewControllers];
    MainTabbar *mainTabbar=[MainTabbar new];
    [self setValue:mainTabbar forKey:@"tabBar"];
    [mainTabbar.plusBtn addTarget:self action:@selector(actionName) forControlEvents:UIControlEventTouchUpInside];
     self.tabBar.tintColor=[UIColor orangeColor];
}
- (void)actionName{



}
- (void)addChildViewControllers{

    [self addChildViewController:[HomeTableViewController new] title:@"首页" imageName:@"tabbar_home"];
    [self addChildViewController:[MessageTableViewController new] title:@"消息" imageName:@"tabbar_message_center"];
    [self addChildViewController:[DiscoverTableViewController new] title:@"发现" imageName:@"tabbar_discover"];
    [self addChildViewController:[ProfileTableViewController new] title:@"我" imageName:@"tabbar_profile"];


}
- (void)addChildViewController:(UIViewController *)vc title:(NSString *)title imageName:(NSString *)imageName{

//    self.tabBar.tintColor=[UIColor orangeColor];
    UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:vc];
    vc.title=title;
    vc.tabBarItem.image=[UIImage imageNamed:imageName];
    [self addChildViewController:nav];

}

@end
